<template>
  <div class="issueOrdecontent">
    <div class="issueOrderPic">
      <img :src="item.orderPicture[0].url || item.orderPicture[0]" alt />
    </div>
    <div class="orderDescribe">
      <div class="address" v-text="item.orderAddress"></div>
      <div class="orderType">
        <img :src="getImage(item.orderType)" alt />
      </div>
      <div class="text">
        <span v-text="item.orderContent" class="textDescribe"></span>
        <van-icon
          name="arrow"
          color="#337AB7"
          size="20px"
          v-if="item.isOrderTaked"
          @click="detailInfo"
        />
      </div>
    </div>
  </div>
</template>

<script>
import expressLogo from 'config/express.js';
import { Icon } from 'vant';

export default {
    props: ['item'],
    name: 'order-content',
    components: {
        [Icon.name]: Icon
    },
    computed: {
        getImage () {
            return function (orderExpress) {
                for (const index in expressLogo) {
                    if (expressLogo[index].name === orderExpress) {
                        return expressLogo[index].src;
                    }
                }
            };
        }
    },
    methods: {
        detailInfo () {
            this.$router.push({
                name: 'transactionDetail',
                params: {
                    id: this.item._id
                }
            });
        }
    }
};
</script>

<style scoped lang="less">
@textColor: #9e9e9e;
.issueOrdecontent {
  padding: 0 6px;
  margin: 10px 0;
  box-sizing: border-box;
  display: flex;
  .issueOrderPic {
    flex: 1;
    img {
      width: 149px;
      height: 149px;
      object-fit: cover;
    }
  }
  .orderDescribe {
    padding: 0 6px;
    box-sizing: border-box;
    width: 8rem;
    font-size: 14px;
    .address {
      color: @textColor;
      font-size: 12px;
      padding: 6px 0;
    }
    .orderType {
      margin: 6px 0;
      border-radius: 4px;
      display: inline-block;
      img {
        height: 38px;
        object-fit: cover;
      }
    }
    .text {
      display: flex;
      justify-content: space-between;
      .textDescribe {
        box-sizing: border-box;
        border-radius: 6px;
        color: #333;
        font-size: 14px;
        overflow: hidden;
        word-break: break-all;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 5;
        -webkit-box-orient: vertical;
      }
      i /deep/ {
        align-self: center;
        font-weight: bolder;
      }
    }
  }
}
</style>
